package com.itheima.day04.myinnerclass.test8;

import java.util.Scanner;

public class Test {
    static Scanner sc = new Scanner(System.in);
    public static void main(String[] args) {
        useAddable(new Addable(){
            @Override
            public int add(int x, int y){
                return Math.max(x,y);
            }
        });
        useAddable((int x, int y) -> {
            return Math.addExact(x,y);
        });

    }

    public static void useAddable(Addable a){
        System.out.println("输入两个整数");
        System.out.println("第一个数：");
        int x = sc.nextInt();
        System.out.println("第二个数：");
        int y = sc.nextInt();
        int number = a.add(x,y);
        System.out.println(number);
    }

}

interface Addable {
    public abstract int add(int x, int y);
}
